package com.woniu.aimd.mapper;

import com.woniu.aimd.pojo.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author zcnovice
 * @data 2025/6/10 上午10:16
 */
@Mapper
public interface UserMapper {
    /**
     * @Description: 增加用户
     * @return:
     * @Author:  zcnovice
     * @date:  2025/6/10 上午10:20
     */
    boolean insert(User user);

    /**
     * @Description:  删除用户
     * @return:
     * @Author:  zcnovice
     * @date:  2025/6/10 上午10:20
     */
    boolean delete(String userId);


    /**
     * @Description: 修改用户
     * @return:
     * @Author:  zcnovice
     * @date:  2025/6/10 上午10:20
     */
    boolean update(User user);

    /**
     * @Description: 条件查询
     * @return:
     * @Author:  zcnovice
     * @date:  2025/6/10 下午1:24
     */
    List<User> findByUser(User user);

    //登录
    @Select("select * from user where account=#{account} and password=#{password}")
    User login(User user);

    //根据id查询
    @Select("select * from user where id = #{id}")
    User findById(Integer id);

    @Insert("insert into studentClass(id,userId,classId) values(#{id},#{userId},#{classId}) ")
    boolean insertStudentClass(@Param("userId") String userId,@Param("classId") Integer classId,@Param("id") String id);
}
